import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
// 获取token
function getPersonalToken(userId) {
  return fetch({
    url: baseUrl + "/compulsory/common/shurui/getToken?userId=" + userId,
    method: 'get'
  });
}
// 题库分类列表
function listCategory(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpoolcategory/listCategory",
    method: 'post',
    data
  });
}

// 题库分类新增
function addCategory(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpoolcategory/addCategory",
    method: 'post',
    data
  });
}

// 题库分类编辑
function editCategory(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpoolcategory/editCategory",
    method: 'post',
    data
  });
}

// 题库分类删除
function deleteCategory(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpoolcategory/deleteCategory",
    method: 'post',
    data
  });
}

// 题库分类查看
function getBank(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpoolcategory/get",
    method: 'post',
    data
  });
}

// 考试列表查询
function listExam(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorexam/listExam",
    method: 'post',
    data
  });
}

// 发布/取消发布考试
function changeReleaseStatus(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorexam/changeReleaseStatus",
    method: 'post',
    data
  });
}

// 绑定课号下拉接口
function getCourses(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorsysdictionary/getCourses",
    method: 'post',
    data
  });
}

// 考试语言下拉接口
function getSubDicList(params) {
  return fetch({
      url: `${baseUrl}/behavior/behaviorsysdictionary/getSubDicList`,
      method: 'get',
      params
  });
}

// 根据题库分类获取对应分类下的所有题库
function getPoolByCategoryId(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpool/getPoolByCategoryId",
    method: 'post',
    data
  });
}

// 根据选择语言获取对应题库分类
function getCategoryByCode(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpoolcategory/getCategoryByCode",
    method: 'post',
    data
  });
}

// 考试列表新增
function addExam(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorexam/addExam",
    method: 'post',
    data
  });
}

// 考试列表编辑
function editExam(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorexam/editExam",
    method: 'post',
    data
  });
}

// 考试列表删除
function deleteExam(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorexam/deleteExam",
    method: 'post',
    data
  });
}

// 考试列表详情
function getExamDetail(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorexam/getExamDetail",
    method: 'post',
    data
  });
}

// 题库名称列表查询
function listQuestionPool(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpool/listQuestionPool",
    method: 'post',
    data
  });
}

// 题库名称列表新增
function addQuestionPool(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpool/addQuestionPool",
    method: 'post',
    data
  });
}

// 题库名称列表编辑
function editQuestionPool(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpool/editQuestionPool",
    method: 'post',
    data
  });
}

// 题库名称列表编辑回显
function getQuestionPool(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpool/get",
    method: 'post',
    data
  });
}

// 题库列表删除
function deleteQuestionPool(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpool/deleteQuestionPool",
    method: 'post',
    data
  });
}

// 题库名称列表查看
function getDetail(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestionpool/getDetail",
    method: 'post',
    data
  });
}

// 试题库列表查询
function listQuestion(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestion/listQuestion",
    method: 'post',
    data
  });
}

// 试题库列表新增
function addQuestion(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestion/addQuestion",
    method: 'post',
    data
  });
}

// 试题库列表编辑
function editQuestion(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestion/editQuestion",
    method: 'post',
    data
  });
}

// 试题库列表删除
function deleteQuestion(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestion/deleteQuestion",
    method: 'post',
    data
  });
}

// 试题库列表查看
function getQuestionDetail(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestion/getQuestionDetail",
    method: 'post',
    data
  });
}

// 试题库列表导出
function questionExport(data) {
  return fetch({
      url: baseUrl + "/behavior/behaviorquestion/export",
      method: 'post',
      data
  });
}

// 试题库列表下载
function downloadTemplate(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestion/downloadTemplate",
    method: 'get',
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '试题导入模板.xlsx', 'application/vnd.ms-excel;charset=utf-8');
  });
}


// 试题库列表导入
function importQuestion(data) {
  return fetch({
    url: baseUrl + "/behavior/behaviorquestion/importQuestion",
    method: 'post',
    data
  });
}



//学术论坛项目新增
function addForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/addForum",
    method: 'post',
    data
  });
}

// 查询学生列表
function postStudentsForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/getStudents",
    method: 'post',
    data
  });
}

// 查询学生列表
function getTeacherInfo(data) {
  return fetch({
    url: baseUrl + "/pgForum/getTeacherInfo",
    method: 'post',
    data
  });
}

// 根据学号查询学生信息
function getStudentsForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/getStudentInfo?studentId=" + data,
    method: 'get'
  });
}

// 一级学科
function getOneSubject(data) {
  return fetch({
    url: baseUrl + "/pgForum/getOneSubject",
    method: 'post',
    data
  });
}

//学术论坛项目编辑
function editForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/editForum",
    method: 'post',
    data
  });
}

//学术论坛项目删除
function delForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/delForum",
    method: 'post',
    data
  });
}

//学术论坛项目详情
function getForumDetails(data) {
  return fetch({
    url: baseUrl + "/pgIntlForum/getForumDetails?id=" + data,
    method: 'get'
  });
}

// 校级项目列表查询
function listSchoolLevelProject(data) {
  return fetch({
    url: baseUrl + "/pgInterschoolLevelProject/listSchoolLevelProjects",
    method: 'post',
    data
  });
}

//  校际交流项目新增列表
function addProject(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolLevelProject/addProject`,
    method: 'Post',
    data
  });
}

//  校际交流项目查看详情
function getProject(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/get`,
    method: 'Post',
    data
  });
}
//  校际交流项目编辑
function editProject(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolLevelProject/editProject`,
    method: 'Post',
    data
  });
}
// 校际交流项目删除
function deleteProject(data) {
  return fetch({
    url: baseUrl + "/pgInterschoolLevelProject/deleteProject",
    method: 'post',
    data
  });
}

//校际交流项目状态变更（启用停用）
function changeProjectStatus(data) {
  return fetch({
    url: baseUrl + "/pgInterschoolLevelProject/changeProjectStatus",
    method: 'post',
    data
  });
}

//校际交流项目指定专家列表
function listDesignatedExperts(data) {
  return fetch({
    url: baseUrl + "/pgOverseasExchangeApply/listDesignatedExperts",
    method: 'post',
    data
  });
}

export default {
  'getPersonalToken': getPersonalToken,
  'listCategory':listCategory,
  'addCategory':addCategory,
  'editCategory':editCategory,
  'deleteCategory':deleteCategory,
  'getBank':getBank,
  'listExam':listExam,
  'getSubDicList':getSubDicList,
  'changeReleaseStatus':changeReleaseStatus,
  'addExam':addExam,
  'getCourses':getCourses,
  'getPoolByCategoryId':getPoolByCategoryId,
  'getCategoryByCode':getCategoryByCode,
  'editExam':editExam,
  'deleteExam':deleteExam,
  'getExamDetail':getExamDetail,
  'listQuestionPool':listQuestionPool,
  'addQuestionPool':addQuestionPool,
  'editQuestionPool':editQuestionPool,
  'getQuestionPool':getQuestionPool,
  'deleteQuestionPool':deleteQuestionPool,
  'getDetail':getDetail,
  'listQuestion': listQuestion,
  'addQuestion': addQuestion,
  'editQuestion': editQuestion,
  'deleteQuestion': deleteQuestion,
  'getQuestionDetail': getQuestionDetail,
  'questionExport': questionExport,
  'downloadTemplate': downloadTemplate,
  'importQuestion': importQuestion,


  'addForum': addForum,
  'postStudentsForum': postStudentsForum,
  'getTeacherInfo': getTeacherInfo,
  'getStudentsForum': getStudentsForum,
  'getOneSubject': getOneSubject,
  'editForum': editForum,
  'delForum': delForum,
  'getForumDetails': getForumDetails,
  'listSchoolLevelProject': listSchoolLevelProject,
  'addProject': addProject,
  'getProject': getProject,
  'editProject': editProject,
  'deleteProject': deleteProject,
  'changeProjectStatus': changeProjectStatus,
  'listDesignatedExperts': listDesignatedExperts
};
